import request from '@/utils/request'

export default {
    reqUserList ({page, limit}, username){
        return request.get(`/admin/acl/user/${page}/${limit}`, {params: {username}})
    },
    reqDelUser (id){
        return request.delete(`/admin/acl/user/remove/${id}`)
    },
    reqDelUserList (idList){
        return request.delete('/admin/acl/user/batchRemove', {params: {idList}})
    },

    // 根据id获取角色列表
    reqRoleListById (userId){
        return request.get(`/admin/acl/user/toAssign/${userId}`)
    },

    // 设置管理用户
    reqSetUser (data){
        return request.put('/admin/acl/user/update', data)
    },
    // 为用户分配角色
    reqSetRole(userId, roleId){
        return request.post('/admin/acl/user/doAssign',null, {params: {userId, roleId}})
    },
    // 新增用户
    reqAddUser (user){
        return request.post('/admin/acl/user/save', user)
    }
}